<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="div">
  <p>我的推广链接：</p>
  <input id="input" value="http://www.baidu.com" readonly/>
  <button onclick="copyUrl()">点击复制链接</button>
</div>
</body>
<script>
  function copyUrl() {
    var Url=document.getElementById("input");
    Url.select(); // 选择对象
    document.execCommand("Copy"); // 执行浏览器复制命令
    layer.msg("复制成功！");
  }
</script>
</html>